import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpType {
  id!: number;
  type!: number;
  title!: string;
  img?: unknown;
  state: boolean = true;
  sort: number = 0;
  pid: number = 0;
  uniacid!: number;
  addTime!: string;
  updateTime!: string;
  level: number = 1;
}

export const ImsYzdKpTypeSchema = new EntitySchema({
  class: ImsYzdKpType,
  properties: {
    id: { primary: true, type: 'number' },
    type: { type: 'number', index: 'type' },
    title: { type: 'string', length: 255 },
    img: { type: 'unknown', columnType: 'longtext', nullable: true },
    state: { type: 'boolean', default: true },
    sort: { type: 'number', default: 0 },
    pid: { type: 'number', default: 0, index: 'pid' },
    uniacid: { type: 'number', index: 'uniacid' },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
    level: { type: 'number', default: 1, index: 'level' },
  },
});
